home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / kuaqe.zip / CLIENT.QC < prev    next >
Text File  |  1996-09-29  |  34KB  |  1,469 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9. void () ChasecamNewlevel;
  10.  
  11. float    modelindex_eyes, modelindex_player;
  12.  
  13. /*
  14. =============================================================================
  15.  
  16.                 LEVEL CHANGING / INTERMISSION
  17.  
  18. =============================================================================
  19. */
  20.  
  21. float    intermission_running;
  22. float    intermission_exittime;
  23.  
  24. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  25. This is the camera point for the intermission.
  26. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  27. */
  28. void() info_intermission =
  29. {
  30. };
  31.  
  32.  
  33.  
  34. void() SetChangeParms =
  35. {
  36. // remove items
  37.     self.items = self.items - (self.items & 
  38.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  39.  
  40. // cap super health
  41.     if (self.health > 100)
  42.         self.health = 100;
  43.     if (self.health < 50)
  44.         self.health = 50;
  45.     parm1 = self.items;
  46.     parm2 = self.health;
  47.     parm3 = self.armorvalue;
  48.     if (self.ammo_shells < 25)
  49.         parm4 = 25;
  50.     else
  51.         parm4 = self.ammo_shells;
  52.     parm5 = self.ammo_nails;
  53.     parm6 = self.ammo_rockets;
  54.     parm7 = self.ammo_cells;
  55.     parm8 = self.weapon;
  56.     parm9 = self.armortype * 100;
  57.         parm10 = self.speed;
  58. };
  59.  
  60. void() SetNewParms =
  61. {
  62.     parm1 = IT_SHOTGUN | IT_AXE;
  63.     parm2 = 100;
  64.     parm3 = 0;
  65.     parm4 = 25;
  66.     parm5 = 0;
  67.     parm6 = 0;
  68.         parm7 = 0;
  69.     parm8 = 1;
  70.     parm9 = 0;
  71.         parm10 = 0;
  72. };
  73.  
  74. void() DecodeLevelParms =
  75. {
  76.     if (serverflags)
  77.     {
  78.         if (world.model == "maps/start.bsp")
  79.             SetNewParms ();        // take away all stuff on starting new episode
  80.     }
  81.     
  82.     self.items = parm1;
  83.     self.health = parm2;
  84.     self.armorvalue = parm3;
  85.     self.ammo_shells = parm4;
  86.     self.ammo_nails = parm5;
  87.     self.ammo_rockets = parm6;
  88.     self.ammo_cells = parm7;
  89.     self.weapon = parm8;
  90.     self.armortype = parm9 * 0.01;
  91.         self.speed = parm10;
  92. };
  93.  
  94. /*
  95. ============
  96. FindIntermission
  97.  
  98. Returns the entity to view from
  99. ============
  100. */
  101. entity() FindIntermission =
  102. {
  103.     local    entity spot;
  104.     local    float cyc;
  105.  
  106. // look for info_intermission first
  107.     spot = find (world, classname, "info_intermission");
  108.     if (spot)
  109.     {    // pick a random one
  110.         cyc = random() * 4;
  111.         while (cyc > 1)
  112.         {
  113.             spot = find (spot, classname, "info_intermission");
  114.             if (!spot)
  115.                 spot = find (spot, classname, "info_intermission");
  116.             cyc = cyc - 1;
  117.         }
  118.         return spot;
  119.     }
  120.  
  121. // then look for the start position
  122.     spot = find (world, classname, "info_player_start");
  123.     if (spot)
  124.         return spot;
  125.     
  126. // testinfo_player_start is only found in regioned levels
  127.     spot = find (world, classname, "testplayerstart");
  128.     if (spot)
  129.         return spot;
  130.     
  131.     objerror ("FindIntermission: no spot");
  132. };
  133.  
  134.  
  135. string nextmap;
  136. void() GotoNextMap =
  137. {
  138.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  139.         changelevel (mapname);
  140.     else
  141.         changelevel (nextmap);
  142. };
  143.  
  144.  
  145. void() ExitIntermission =
  146. {
  147. // skip any text in deathmatch
  148.     if (deathmatch)
  149.     {
  150.         GotoNextMap ();
  151.         return;
  152.     }
  153.     
  154.     intermission_exittime = time + 1;
  155.     intermission_running = intermission_running + 1;
  156.  
  157. //
  158. // run some text if at the end of an episode
  159. //
  160.     if (intermission_running == 2)
  161.     {
  162.         if (world.model == "maps/e1m7.bsp")
  163.         {
  164.             WriteByte (MSG_ALL, SVC_CDTRACK);
  165.             WriteByte (MSG_ALL, 2);
  166.             WriteByte (MSG_ALL, 3);
  167.             if (!cvar("registered"))
  168.             {
  169.                 WriteByte (MSG_ALL, SVC_FINALE);
  170.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  171.             }
  172.             else
  173.             {
  174.                 WriteByte (MSG_ALL, SVC_FINALE);
  175.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  176.             }
  177.             return;
  178.         }
  179.         else if (world.model == "maps/e2m6.bsp")
  180.         {
  181.             WriteByte (MSG_ALL, SVC_CDTRACK);
  182.             WriteByte (MSG_ALL, 2);
  183.             WriteByte (MSG_ALL, 3);
  184.  
  185.             WriteByte (MSG_ALL, SVC_FINALE);
  186.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  187.             return;
  188.         }
  189.         else if (world.model == "maps/e3m6.bsp")
  190.         {
  191.             WriteByte (MSG_ALL, SVC_CDTRACK);
  192.             WriteByte (MSG_ALL, 2);
  193.             WriteByte (MSG_ALL, 3);
  194.  
  195.             WriteByte (MSG_ALL, SVC_FINALE);
  196.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  197.             return;
  198.         }
  199.         else if (world.model == "maps/e4m7.bsp")
  200.         {
  201.             WriteByte (MSG_ALL, SVC_CDTRACK);
  202.             WriteByte (MSG_ALL, 2);
  203.             WriteByte (MSG_ALL, 3);
  204.  
  205.             WriteByte (MSG_ALL, SVC_FINALE);
  206.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  207.             return;
  208.         }
  209.  
  210.         GotoNextMap();
  211.     }
  212.     
  213.     if (intermission_running == 3)
  214.     {
  215.         if (!cvar("registered"))
  216.         {    // shareware episode has been completed, go to sell screen
  217.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  218.             return;
  219.         }
  220.         
  221.         if ( (serverflags&15) == 15)
  222.         {
  223.             WriteByte (MSG_ALL, SVC_FINALE);
  224.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  225.             return;
  226.         }
  227.         
  228.     }
  229.  
  230.     GotoNextMap();
  231. };
  232.  
  233. /*
  234. ============
  235. IntermissionThink
  236.  
  237. When the player presses attack or jump, change to the next level
  238. ============
  239. */
  240. void() IntermissionThink =
  241. {
  242. //      if (time < intermission_exittime)
  243. //              return;
  244.  
  245.     if (!self.button0 && !self.button1 && !self.button2)
  246.         return;
  247.     
  248.     ExitIntermission ();
  249. };
  250.  
  251. void() execute_changelevel =
  252. {
  253.     local entity    pos;
  254.  
  255.     intermission_running = 1;
  256.     
  257. // enforce a wait time before allowing changelevel
  258.     if (deathmatch)
  259.         intermission_exittime = time + 5;
  260.     else
  261.         intermission_exittime = time + 2;
  262.  
  263.     WriteByte (MSG_ALL, SVC_CDTRACK);
  264.     WriteByte (MSG_ALL, 3);
  265.     WriteByte (MSG_ALL, 3);
  266.     
  267.     pos = FindIntermission ();
  268.  
  269.     other = find (world, classname, "player");
  270.     while (other != world)
  271.     {
  272.         other.view_ofs = '0 0 0';
  273.         other.angles = other.v_angle = pos.mangle;
  274.         other.fixangle = TRUE;        // turn this way immediately
  275.         other.nextthink = time + 0.5;
  276.         other.takedamage = DAMAGE_NO;
  277.         other.solid = SOLID_NOT;
  278.         other.movetype = MOVETYPE_NONE;
  279.         other.modelindex = 0;
  280.         setorigin (other, pos.origin);
  281.         other = find (other, classname, "player");
  282.     }    
  283.  
  284.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  285. };
  286.  
  287.  
  288. void() changelevel_touch =
  289. {
  290.     local entity    pos;
  291.  
  292.     if (other.classname != "player")
  293.         return;
  294.  
  295.     if (cvar("noexit"))
  296.     {
  297.         T_Damage (other, self, self, 50000);
  298.         return;
  299.     }
  300.     bprint (other.netname);
  301.     bprint (" exited the level\n");
  302.  
  303.     nextmap = self.map;
  304.  
  305.     SUB_UseTargets ();
  306.  
  307.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  308.     {    // NO_INTERMISSION
  309.         GotoNextMap();
  310.         return;
  311.     }
  312.     
  313.     self.touch = SUB_Null;
  314.  
  315. // we can't move people right now, because touch functions are called
  316. // in the middle of C movement code, so set a think time to do it
  317.     self.think = execute_changelevel;
  318.     self.nextthink = time + 0.1;
  319. };
  320.  
  321. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  322. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  323. */
  324. void() trigger_changelevel =
  325. {
  326.     if (!self.map)
  327.         objerror ("chagnelevel trigger doesn't have map");
  328.     
  329.     InitTrigger ();
  330.     self.touch = changelevel_touch;
  331. };
  332.  
  333.  
  334. /*
  335. =============================================================================
  336.  
  337.                 PLAYER GAME EDGE FUNCTIONS
  338.  
  339. =============================================================================
  340. */
  341.  
  342. void() set_suicide_frame;
  343.  
  344. // called by ClientKill and DeadThink
  345. void() respawn =
  346. {
  347.     if (coop)
  348.     {
  349.         // make a copy of the dead body for appearances sake
  350.         CopyToBodyQue (self);
  351.         // get the spawn parms as they were at level start
  352.         setspawnparms (self);
  353.         // respawn        
  354.         PutClientInServer ();
  355.     }
  356.     else if (deathmatch)
  357.     {
  358.         // make a copy of the dead body for appearances sake
  359.         CopyToBodyQue (self);
  360.         // set default spawn parms
  361.         SetNewParms ();
  362.         // respawn        
  363.         PutClientInServer ();
  364.     }
  365.     else
  366.     {    // restart the entire server
  367.         localcmd ("restart\n");
  368.     }
  369. };
  370.  
  371.  
  372. /*
  373. ============
  374. ClientKill
  375.  
  376. Player entered the suicide command
  377. ============
  378. */
  379. void() ClientKill =
  380. {
  381.     bprint (self.netname);
  382.     bprint (" suicides\n");
  383.     set_suicide_frame ();
  384.     self.modelindex = modelindex_player;
  385.     self.frags = self.frags - 2;    // extra penalty
  386.     respawn ();
  387. };
  388.  
  389. float(vector v) CheckSpawnPoint =
  390. {
  391.     return FALSE;
  392. };
  393.  
  394. /*
  395. ============
  396. SelectSpawnPoint
  397.  
  398. Returns the entity to spawn at
  399. ============
  400. */
  401. entity() SelectSpawnPoint =
  402. {
  403.     local    entity spot;
  404.     
  405. // testinfo_player_start is only found in regioned levels
  406.     spot = find (world, classname, "testplayerstart");
  407.     if (spot)
  408.         return spot;
  409.         
  410. // choose a info_player_deathmatch point
  411.     if (coop)
  412.     {
  413.         lastspawn = find(lastspawn, classname, "info_player_coop");
  414.         if (lastspawn == world)
  415.             lastspawn = find (lastspawn, classname, "info_player_start");
  416.         if (lastspawn != world)
  417.             return lastspawn;
  418.     }
  419.     else if (deathmatch)
  420.     {
  421.         lastspawn = find(lastspawn, classname, "info_player_deathmatch");
  422.         if (lastspawn == world)
  423.             lastspawn = find (lastspawn, classname, "info_player_deathmatch");
  424.         if (lastspawn != world)
  425.             return lastspawn;
  426.     }
  427.  
  428.     if (serverflags)
  429.     {    // return with a rune to start
  430.         spot = find (world, classname, "info_player_start2");
  431.         if (spot)
  432.             return spot;
  433.     }
  434.     
  435.     spot = find (world, classname, "info_player_start");
  436.     if (!spot)
  437.         error ("PutClientInServer: no info_player_start on level");
  438.     
  439.     return spot;
  440. };
  441.  
  442. /*
  443. ===========
  444. PutClientInServer
  445.  
  446. called each time a player is spawned
  447. ============
  448. */
  449. void() DecodeLevelParms;
  450. void() PlayerDie;
  451.  
  452.  
  453. void() PutClientInServer =
  454. {
  455.         local   entity spot,
  456.                        thinker;
  457.  
  458.     self.classname = "player";
  459.     self.health = 100;
  460.     self.takedamage = DAMAGE_AIM;
  461.     self.solid = SOLID_SLIDEBOX;
  462.     self.movetype = MOVETYPE_WALK;
  463.     self.show_hostile = 0;
  464.     self.max_health = 100;
  465.     self.flags = FL_CLIENT;
  466.     self.air_finished = time + 12;
  467.     self.dmg = 2;           // initial water damage
  468.     self.super_damage_finished = 0;
  469.     self.radsuit_finished = 0;
  470.     self.invisible_finished = 0;
  471.     self.invincible_finished = 0;
  472.     self.effects = 0;
  473.     self.invincible_time = 0;
  474.  
  475.     DecodeLevelParms ();
  476.     
  477.     W_SetCurrentAmmo ();
  478.  
  479.     self.attack_finished = time;
  480.     self.th_pain = player_pain;
  481.     self.th_die = PlayerDie;
  482.     
  483.     self.deadflag = DEAD_NO;
  484. // paustime is set by teleporters to keep the player from moving a while
  485.     self.pausetime = 0;
  486.     
  487.     spot = SelectSpawnPoint ();
  488.  
  489.     self.origin = spot.origin + '0 0 1';
  490.     self.angles = spot.angles;
  491.     self.fixangle = TRUE;        // turn this way immediately
  492.  
  493. // oh, this is a hack!
  494.     setmodel (self, "progs/eyes.mdl");
  495.     modelindex_eyes = self.modelindex;
  496.  
  497.     setmodel (self, "progs/player.mdl");
  498.     modelindex_player = self.modelindex;
  499.  
  500.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  501.     
  502.     self.view_ofs = '0 0 22';
  503.  
  504.     player_stand1 ();
  505.     
  506.     if (deathmatch || coop)
  507.     {
  508.         makevectors(self.angles);
  509.         spawn_tfog (self.origin + v_forward*20);
  510.     }
  511.  
  512.     spawn_tdeath (self.origin, self);
  513.  
  514.         // Added for ChaseCam
  515.         thinker = spawn ();
  516.         thinker.owner = self;
  517.         thinker.movetype = MOVETYPE_NONE;
  518.         thinker.solid = SOLID_NOT;
  519.         setmodel (thinker, "");
  520.         setsize (thinker, VEC_ORIGIN, VEC_ORIGIN);
  521.         setorigin (thinker, thinker.owner.origin);
  522.         thinker.think = ChasecamNewlevel;
  523.         thinker.nextthink = time + 0.2;
  524. };
  525.  
  526.  
  527. /*
  528. =============================================================================
  529.  
  530.                 QUAKED FUNCTIONS
  531.  
  532. =============================================================================
  533. */
  534.  
  535.  
  536. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  537. The normal starting point for a level.
  538. */
  539. void() info_player_start =
  540. {
  541. };
  542.  
  543.  
  544. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  545. Only used on start map for the return point from an episode.
  546. */
  547. void() info_player_start2 =
  548. {
  549. };
  550.  
  551.  
  552. /*
  553. saved out by quaked in region mode
  554. */
  555. void() testplayerstart =
  556. {
  557. };
  558.  
  559. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  560. potential spawning position for deathmatch games
  561. */
  562. void() info_player_deathmatch =
  563. {
  564. };
  565.  
  566. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  567. potential spawning position for coop games
  568. */
  569. void() info_player_coop =
  570. {
  571. };
  572.  
  573. /*
  574. ===============================================================================
  575.  
  576. RULES
  577.  
  578. ===============================================================================
  579. */
  580.  
  581. void(entity c) PrintClientScore =
  582. {
  583.     if (c.frags > -10 && c.frags < 0)
  584.         bprint (" ");
  585.     else if (c.frags >= 0)
  586.     {
  587.         if (c.frags < 100)
  588.             bprint (" ");
  589.         if (c.frags < 10)
  590.             bprint (" ");
  591.     }
  592.     bprint (ftos(c.frags));
  593.     bprint (" ");
  594.     bprint (c.netname);
  595.     bprint ("\n");
  596. };
  597.  
  598. void() DumpScore =
  599. {
  600.     local entity    e, sort, walk;
  601.  
  602.     if (world.chain)
  603.         error ("DumpScore: world.chain is set");
  604.  
  605. // build a sorted lis
  606.     e = find(world, classname, "player");
  607.     sort = world;
  608.     while (e)
  609.     {
  610.         if (!sort)
  611.         {
  612.             sort = e;
  613.             e.chain = world;
  614.         }
  615.         else
  616.         {
  617.             if (e.frags > sort.frags)
  618.             {
  619.                 e.chain = sort;
  620.                 sort = e;
  621.             }
  622.             else
  623.             {
  624.                 walk = sort;
  625.                 do
  626.                 {
  627.                     if (!walk.chain)
  628.                     {
  629.                         e.chain = world;
  630.                         walk.chain = e;
  631.                     }
  632.                     else if (walk.chain.frags < e.frags)
  633.                     {
  634.                         e.chain = walk.chain;
  635.                         walk.chain = e;
  636.                     }
  637.                     else
  638.                         walk = walk.chain;
  639.                 } while (walk.chain != e);
  640.             }
  641.         }
  642.         
  643.         e = find(e, classname, "player");
  644.     }
  645.  
  646. // print the list
  647.     
  648.     bprint ("\n");    
  649.     while (sort)
  650.     {
  651.         PrintClientScore (sort);
  652.         sort = sort.chain;
  653.     }
  654.     bprint ("\n");
  655. };
  656.  
  657. /*
  658. go to the next level for deathmatch
  659. */
  660. void() NextLevel =
  661. {
  662.     local entity o;
  663.  
  664. // find a trigger changelevel
  665.     o = find(world, classname, "trigger_changelevel");
  666.     if (!o || mapname == "start")
  667.     {    // go back to same map if no trigger_changelevel
  668.         o = spawn();
  669.         o.map = mapname;
  670.     }
  671.  
  672.     nextmap = o.map;
  673.     
  674.     if (o.nextthink < time)
  675.     {
  676.         o.think = execute_changelevel;
  677.         o.nextthink = time + 0.1;
  678.     }
  679. };
  680.  
  681. /*
  682. ============
  683. CheckRules
  684.  
  685. Exit deathmatch games upon conditions
  686. ============
  687. */
  688. void() CheckRules =
  689. {
  690.     local    float        timelimit;
  691.     local    float        fraglimit;
  692.     
  693.     if (gameover)    // someone else quit the game already
  694.         return;
  695.         
  696.     timelimit = cvar("timelimit") * 60;
  697.     fraglimit = cvar("fraglimit");
  698.     
  699.     if (timelimit && time >= timelimit)
  700.     {
  701. NextLevel ();
  702. /*
  703.         gameover = TRUE;
  704.         bprint ("\n\n\n==============================\n");
  705.         bprint ("game exited after ");
  706.         bprint (ftos(timelimit/60));
  707.         bprint (" minutes\n");
  708.         DumpScore ();
  709.         localcmd ("killserver\n");
  710. */
  711.         return;
  712.     }
  713.     
  714.     if (fraglimit && self.frags >= fraglimit)
  715.     {
  716. NextLevel ();
  717. /*
  718.         gameover = TRUE;
  719.         bprint ("\n\n\n==============================\n");
  720.         bprint ("game exited after ");
  721.         bprint (ftos(self.frags));
  722.         bprint (" frags\n");
  723.         DumpScore ();
  724.         localcmd ("killserver\n");
  725. */
  726.         return;
  727.     }    
  728. };
  729.  
  730. //============================================================================
  731.  
  732. void() PlayerDeathThink =
  733. {
  734.     local entity    old_self;
  735.     local float        forward;
  736.  
  737.     if ((self.flags & FL_ONGROUND))
  738.     {
  739.         forward = vlen (self.velocity);
  740.         forward = forward - 20;
  741.         if (forward <= 0)
  742.             self.velocity = '0 0 0';
  743.         else    
  744.             self.velocity = forward * normalize(self.velocity);
  745.     }
  746.  
  747. // wait for all buttons released
  748.     if (self.deadflag == DEAD_DEAD)
  749.     {
  750.         if (self.button2 || self.button1 || self.button0)
  751.             return;
  752.         self.deadflag = DEAD_RESPAWNABLE;
  753.         return;
  754.     }
  755.  
  756. // wait for any button down
  757.     if (!self.button2 && !self.button1 && !self.button0)
  758.         return;
  759.  
  760.     self.button0 = 0;
  761.     self.button1 = 0;
  762.     self.button2 = 0;
  763.     respawn();
  764. };
  765.  
  766.  
  767. void() PlayerJump =
  768. {
  769.     local vector start, end;
  770.     
  771.     if (self.flags & FL_WATERJUMP)
  772.         return;
  773.     
  774.     if (self.waterlevel >= 2)
  775.     {
  776.         if (self.watertype == CONTENT_WATER)
  777.             self.velocity_z = 100;
  778.         else if (self.watertype == CONTENT_SLIME)
  779.             self.velocity_z = 80;
  780.         else
  781.             self.velocity_z = 50;
  782.  
  783. // play swiming sound
  784.         if (self.swim_flag < time)
  785.         {
  786.             self.swim_flag = time + 1;
  787.             if (random() < 0.5)
  788.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  789.             else
  790.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  791.         }
  792.  
  793.         return;
  794.     }
  795.  
  796.     if (!(self.flags & FL_ONGROUND))
  797.         return;
  798.  
  799.     if ( !(self.flags & FL_JUMPRELEASED) )
  800.         return;        // don't pogo stick
  801.  
  802.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  803.  
  804.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  805.     
  806.     self.button2 = 0;
  807. // player jumping sound
  808.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  809.     self.velocity_z = self.velocity_z + 270;
  810. };
  811.  
  812.  
  813. /*
  814. ===========
  815. WaterMove
  816.  
  817. ============
  818. */
  819. .float    dmgtime;
  820.  
  821. void() WaterMove =
  822. {
  823. //dprint (ftos(self.waterlevel));
  824.     if (self.movetype == MOVETYPE_NOCLIP)
  825.         return;
  826.     if (self.health < 0)
  827.         return;
  828.  
  829.     if (self.waterlevel != 3)
  830.     {
  831.         if (self.air_finished < time)
  832.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  833.         else if (self.air_finished < time + 9)
  834.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  835.         self.air_finished = time + 12;
  836.         self.dmg = 2;
  837.     }
  838.     else if (self.air_finished < time)
  839.     {    // drown!
  840.         if (self.pain_finished < time)
  841.         {
  842.             self.dmg = self.dmg + 2;
  843.             if (self.dmg > 15)
  844.                 self.dmg = 10;
  845.             T_Damage (self, world, world, self.dmg);
  846.             self.pain_finished = time + 1;
  847.         }
  848.     }
  849.     
  850.     if (!self.waterlevel)
  851.     {
  852.         if (self.flags & FL_INWATER)
  853.         {    
  854.             // play leave water sound
  855.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  856.             self.flags = self.flags - FL_INWATER;
  857.         }
  858.         return;
  859.     }
  860.  
  861.     if (self.watertype == CONTENT_LAVA)
  862.     {    // do damage
  863.         if (self.dmgtime < time)
  864.         {
  865.             if (self.radsuit_finished > time)
  866.                 self.dmgtime = time + 1;
  867.             else
  868.                 self.dmgtime = time + 0.2;
  869.  
  870.             T_Damage (self, world, world, 10*self.waterlevel);
  871.         }
  872.     }
  873.     else if (self.watertype == CONTENT_SLIME)
  874.     {    // do damage
  875.         if (self.dmgtime < time && self.radsuit_finished < time)
  876.         {
  877.             self.dmgtime = time + 1;
  878.             T_Damage (self, world, world, 4*self.waterlevel);
  879.         }
  880.     }
  881.     
  882.     if ( !(self.flags & FL_INWATER) )
  883.     {    
  884.  
  885. // player enter water sound
  886.  
  887.         if (self.watertype == CONTENT_LAVA)
  888.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  889.         if (self.watertype == CONTENT_WATER)
  890.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  891.         if (self.watertype == CONTENT_SLIME)
  892.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  893.  
  894.         self.flags = self.flags + FL_INWATER;
  895.         self.dmgtime = 0;
  896.     }
  897.     
  898.     if (! (self.flags & FL_WATERJUMP) )
  899.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  900. };
  901.  
  902. void() CheckWaterJump =
  903. {
  904.     local vector start, end;
  905.  
  906. // check for a jump-out-of-water
  907.     makevectors (self.angles);
  908.     start = self.origin;
  909.     start_z = start_z + 8; 
  910.     v_forward_z = 0;
  911.     normalize(v_forward);
  912.     end = start + v_forward*24;
  913.     traceline (start, end, TRUE, self);
  914.     if (trace_fraction < 1)
  915.     {    // solid at waist
  916.         start_z = start_z + self.maxs_z - 8;
  917.         end = start + v_forward*24;
  918.         self.movedir = trace_plane_normal * -50;
  919.         traceline (start, end, TRUE, self);
  920.         if (trace_fraction == 1)
  921.         {    // open at eye level
  922.             self.flags = self.flags | FL_WATERJUMP;
  923.             self.velocity_z = 225;
  924.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  925.             self.teleport_time = time + 2;    // safety net
  926.             return;
  927.         }
  928.     }
  929. };
  930.  
  931.  
  932. /*
  933. ================
  934. PlayerPreThink
  935.  
  936. Called every frame before physics are run
  937. ================
  938. */
  939. void() PlayerPreThink =
  940. {
  941.     local    float    mspeed, aspeed;
  942.     local    float    r;
  943.  
  944.     if (intermission_running)
  945.     {
  946.         IntermissionThink ();    // otherwise a button could be missed between
  947.         return;                    // the think tics
  948.     }
  949.  
  950.     if (self.view_ofs == '0 0 0')
  951.         return;        // intermission or finale
  952.  
  953.     makevectors (self.v_angle);        // is this still used
  954.  
  955.     CheckRules ();
  956.     WaterMove ();
  957.  
  958.     if (self.waterlevel == 2)
  959.         CheckWaterJump ();
  960.  
  961.     if (self.deadflag >= DEAD_DEAD)
  962.     {
  963.         PlayerDeathThink ();
  964.         return;
  965.     }
  966.     
  967.     if (self.deadflag == DEAD_DYING)
  968.         return;    // dying, so do nothing
  969.  
  970.     if (self.button2)
  971.     {
  972.         PlayerJump ();
  973.     }
  974.     else
  975.         self.flags = self.flags | FL_JUMPRELEASED;
  976.  
  977. // teleporters can force a non-moving pause time    
  978.     if (time < self.pausetime)
  979.         self.velocity = '0 0 0';
  980. };
  981.     
  982. /*
  983. ================
  984. CheckPowerups
  985.  
  986. Check for turning off powerups
  987. ================
  988. */
  989. void() CheckPowerups =
  990. {
  991.     if (self.health <= 0)
  992.         return;
  993.  
  994. // invisibility
  995.     if (self.invisible_finished)
  996.     {
  997. // sound and screen flash when items starts to run out
  998.         if (self.invisible_sound < time)
  999.         {
  1000.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  1001.             self.invisible_sound = time + ((random() * 3) + 1);
  1002.         }
  1003.  
  1004.  
  1005.         if (self.invisible_finished < time + 3)
  1006.         {
  1007.             if (self.invisible_time == 1)
  1008.             {
  1009.                 sprint (self, "Ring of Shadows magic is fading\n");
  1010.                 stuffcmd (self, "bf\n");
  1011.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  1012.                 self.invisible_time = time + 1;
  1013.             }
  1014.             
  1015.             if (self.invisible_time < time)
  1016.             {
  1017.                 self.invisible_time = time + 1;
  1018.                 stuffcmd (self, "bf\n");
  1019.             }
  1020.         }
  1021.  
  1022.         if (self.invisible_finished < time)
  1023.         {    // just stopped
  1024.             self.items = self.items - IT_INVISIBILITY;
  1025.             self.invisible_finished = 0;
  1026.             self.invisible_time = 0;
  1027.         }
  1028.         
  1029.     // use the eyes
  1030.         self.frame = 0;
  1031.         self.modelindex = modelindex_eyes;
  1032.     }
  1033.     else
  1034.         self.modelindex = modelindex_player;    // don't use eyes
  1035.  
  1036. // invincibility
  1037.     if (self.invincible_finished)
  1038.     {
  1039. // sound and screen flash when items starts to run out
  1040.         if (self.invincible_finished < time + 3)
  1041.         {
  1042.             if (self.invincible_time == 1)
  1043.             {
  1044.                 sprint (self, "Protection is almost burned out\n");
  1045.                 stuffcmd (self, "bf\n");
  1046.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1047.                 self.invincible_time = time + 1;
  1048.             }
  1049.             
  1050.             if (self.invincible_time < time)
  1051.             {
  1052.                 self.invincible_time = time + 1;
  1053.                 stuffcmd (self, "bf\n");
  1054.             }
  1055.         }
  1056.         
  1057.         if (self.invincible_finished < time)
  1058.         {    // just stopped
  1059.             self.items = self.items - IT_INVULNERABILITY;
  1060.             self.invincible_time = 0;
  1061.             self.invincible_finished = 0;
  1062.         }
  1063.         if (self.invincible_finished > time)
  1064.             self.effects = self.effects | EF_DIMLIGHT;
  1065.         else
  1066.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1067.     }
  1068.  
  1069. // super damage
  1070.     if (self.super_damage_finished)
  1071.     {
  1072.  
  1073. // sound and screen flash when items starts to run out
  1074.  
  1075.         if (self.super_damage_finished < time + 3)
  1076.         {
  1077.             if (self.super_time == 1)
  1078.             {
  1079.                 sprint (self, "Quad Damage is wearing off\n");
  1080.                 stuffcmd (self, "bf\n");
  1081.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1082.                 self.super_time = time + 1;
  1083.             }      
  1084.             
  1085.             if (self.super_time < time)
  1086.             {
  1087.                 self.super_time = time + 1;
  1088.                 stuffcmd (self, "bf\n");
  1089.             }
  1090.         }
  1091.  
  1092.         if (self.super_damage_finished < time)
  1093.         {    // just stopped
  1094.             self.items = self.items - IT_QUAD;
  1095.             self.super_damage_finished = 0;
  1096.             self.super_time = 0;
  1097.         }
  1098.         if (self.super_damage_finished > time)
  1099.             self.effects = self.effects | EF_DIMLIGHT;
  1100.         else
  1101.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1102.     }    
  1103.  
  1104. // suit    
  1105.     if (self.radsuit_finished)
  1106.     {
  1107.         self.air_finished = time + 12;        // don't drown
  1108.  
  1109. // sound and screen flash when items starts to run out
  1110.         if (self.radsuit_finished < time + 3)
  1111.         {
  1112.             if (self.rad_time == 1)
  1113.             {
  1114.                 sprint (self, "Air supply in Biosuit expiring\n");
  1115.                 stuffcmd (self, "bf\n");
  1116.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1117.                 self.rad_time = time + 1;
  1118.             }
  1119.             
  1120.             if (self.rad_time < time)
  1121.             {
  1122.                 self.rad_time = time + 1;
  1123.                 stuffcmd (self, "bf\n");
  1124.             }
  1125.         }
  1126.  
  1127.         if (self.radsuit_finished < time)
  1128.         {    // just stopped
  1129.             self.items = self.items - IT_SUIT;
  1130.             self.rad_time = 0;
  1131.             self.radsuit_finished = 0;
  1132.         }
  1133.     }    
  1134.  
  1135. };
  1136.  
  1137.  
  1138. /*
  1139. ================
  1140. PlayerPostThink
  1141.  
  1142. Called every frame after physics are run
  1143. ================
  1144. */
  1145. void() PlayerPostThink =
  1146. {
  1147.     local    float    mspeed, aspeed;
  1148.     local    float    r;
  1149.  
  1150.     if (self.view_ofs == '0 0 0')
  1151.         return;        // intermission or finale
  1152.     if (self.deadflag)
  1153.         return;
  1154.         
  1155. // do weapon stuff
  1156.  
  1157.     W_WeaponFrame ();
  1158.  
  1159. // check to see if player landed and play landing sound    
  1160.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1161.     {
  1162.         if (self.watertype == CONTENT_WATER)
  1163.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1164.         else if (self.jump_flag < -650)
  1165.         {
  1166.             T_Damage (self, world, world, 5); 
  1167.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1168.             self.deathtype = "falling";
  1169.         }
  1170.         else
  1171.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1172.  
  1173.         self.jump_flag = 0;
  1174.     }
  1175.  
  1176.     if (!(self.flags & FL_ONGROUND))
  1177.         self.jump_flag = self.velocity_z;
  1178.  
  1179.     CheckPowerups ();
  1180. };
  1181.  
  1182.  
  1183. /*
  1184. ===========
  1185. ClientConnect
  1186.  
  1187. called when a player connects to a server
  1188. ============
  1189. */
  1190. void() ClientConnect =
  1191. {
  1192.     bprint (self.netname);
  1193.     bprint (" entered the game\n");
  1194.     
  1195. // a client connecting during an intermission can cause problems
  1196.     if (intermission_running)
  1197.         ExitIntermission ();
  1198. };
  1199.  
  1200.  
  1201. /*
  1202. ===========
  1203. ClientDisconnect
  1204.  
  1205. called when a player disconnects from a server
  1206. ============
  1207. */
  1208. void() ClientDisconnect =
  1209. {
  1210.     if (gameover)
  1211.         return;
  1212.     // if the level end trigger has been activated, just return
  1213.     // since they aren't *really* leaving
  1214.  
  1215.     // let everyone else know
  1216.     bprint (self.netname);
  1217.     bprint (" left the game with ");
  1218.     bprint (ftos(self.frags));
  1219.     bprint (" frags\n");
  1220.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1221.     set_suicide_frame ();
  1222. };
  1223.  
  1224. /*
  1225. ===========
  1226. ClientObituary
  1227.  
  1228. called when a player dies
  1229. ============
  1230. */
  1231. void(entity targ, entity attacker) ClientObituary =
  1232. {
  1233.     local    float rnum;
  1234.     local    string deathstring, deathstring2;
  1235.     rnum = random();
  1236.  
  1237.     if (targ.classname == "player")
  1238.     {
  1239.         if (attacker.classname == "teledeath")
  1240.         {
  1241.             bprint (targ.netname);
  1242.             bprint (" was telefragged by ");
  1243.             bprint (attacker.owner.netname);
  1244.             bprint ("\n");
  1245.  
  1246.             attacker.owner.frags = attacker.owner.frags + 1;
  1247.             return;
  1248.         }
  1249.  
  1250.         if (attacker.classname == "teledeath2")
  1251.         {
  1252.             bprint ("Satan's power deflects ");
  1253.             bprint (targ.netname);
  1254.             bprint ("'s telefrag\n");
  1255.  
  1256.             targ.frags = targ.frags - 1;
  1257.             return;
  1258.         }
  1259.  
  1260.         if (attacker.classname == "player")
  1261.         {
  1262.             if (targ == attacker)
  1263.             {
  1264.                 // killed self
  1265.                 attacker.frags = attacker.frags - 1;
  1266.                 bprint (targ.netname);
  1267.                 
  1268.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1269.                 {
  1270.                     bprint (" discharges into the water.\n");
  1271.                     return;
  1272.                 }
  1273.                 if (targ.weapon == 16)
  1274.                     bprint (" tries to put the pin back in\n");
  1275.                 else if (rnum)
  1276.                     bprint (" becomes bored with life\n");
  1277.                 else
  1278.                     bprint (" checks if his weapon is loaded\n");
  1279.                 return;
  1280.             }
  1281.             else
  1282.             {
  1283.                 attacker.frags = attacker.frags + 1;
  1284.  
  1285.                 rnum = attacker.weapon;
  1286.                 if (rnum == IT_AXE)
  1287.                 {
  1288.                     deathstring = " was ax-murdered by ";
  1289.                     deathstring2 = "\n";
  1290.                 }
  1291.                 if (rnum == IT_SHOTGUN)
  1292.                 {
  1293.                     deathstring = " chewed on ";
  1294.                     deathstring2 = "'s boomstick\n";
  1295.                 }
  1296.                 if (rnum == IT_SUPER_SHOTGUN)
  1297.                 {
  1298.                     deathstring = " ate 2 loads of ";
  1299.                     deathstring2 = "'s buckshot\n";
  1300.                 }
  1301.                 if (rnum == IT_NAILGUN)
  1302.                 {
  1303.                     deathstring = " was nailed by ";
  1304.                     deathstring2 = "\n";
  1305.                 }
  1306.                 if (rnum == IT_SUPER_NAILGUN)
  1307.                 {
  1308.                     deathstring = " was punctured by ";
  1309.                     deathstring2 = "\n";
  1310.                 }
  1311.                 if (rnum == IT_GRENADE_LAUNCHER)
  1312.                 {
  1313.                     deathstring = " eats ";
  1314.                     deathstring2 = "'s pineapple\n";
  1315.                     if (targ.health < -40)
  1316.                     {
  1317.                         deathstring = " was gibbed by ";
  1318.                         deathstring2 = "'s grenade\n";
  1319.                     }
  1320.                 }
  1321.                 if (rnum == IT_ROCKET_LAUNCHER)
  1322.                 {
  1323.                     deathstring = " rides ";
  1324.                     deathstring2 = "'s rocket\n";
  1325.                     if (targ.health < -40)
  1326.                     {
  1327.                         deathstring = " was gibbed by ";
  1328.                         deathstring2 = "'s rocket\n" ;
  1329.                     }
  1330.                 }
  1331.                 if (rnum == IT_LIGHTNING)
  1332.                 {
  1333.                     deathstring = " accepts ";
  1334.                     if (attacker.waterlevel > 1)
  1335.                         deathstring2 = "'s discharge\n";
  1336.                     else
  1337.                         deathstring2 = "'s shaft\n";
  1338.                 }
  1339.                 bprint (targ.netname);
  1340.                 bprint (deathstring);
  1341.                 bprint (attacker.netname);
  1342.                 bprint (deathstring2);
  1343.             }
  1344.             return;
  1345.         }
  1346.         else
  1347.         {
  1348.             targ.frags = targ.frags - 1;        // killed self
  1349.             rnum = targ.watertype;
  1350.  
  1351.             bprint (targ.netname);
  1352.             if (rnum == -3)
  1353.             {
  1354.                 if (random() < 0.5)
  1355.                     bprint (" sleeps with the fishes\n");
  1356.                 else
  1357.                     bprint (" sucks it down\n");
  1358.                 return;
  1359.             }
  1360.             else if (rnum == -4)
  1361.             {
  1362.                 if (random() < 0.5)
  1363.                     bprint (" gulped a load of slime\n");
  1364.                 else
  1365.                     bprint (" can't exist on slime alone\n");
  1366.                 return;
  1367.             }
  1368.             else if (rnum == -5)
  1369.             {
  1370.                 if (targ.health < -15)
  1371.                 {
  1372.                     bprint (" burst into flames\n");
  1373.                     return;
  1374.                 }
  1375.                 if (random() < 0.5)
  1376.                     bprint (" turned into hot slag\n");
  1377.                 else
  1378.                     bprint (" visits the Volcano God\n");
  1379.                 return;
  1380.             }
  1381.  
  1382.             if (attacker.flags & FL_MONSTER)
  1383.             {
  1384.                 if (attacker.classname == "monster_army")
  1385.                     bprint (" was shot by a Grunt\n");
  1386.                 if (attacker.classname == "monster_demon1")
  1387.                     bprint (" was eviscerated by a Fiend\n");
  1388.                 if (attacker.classname == "monster_dog")
  1389.                     bprint (" was mauled by a Rottweiler\n");
  1390.                 if (attacker.classname == "monster_dragon")
  1391.                     bprint (" was fried by a Dragon\n");
  1392.                 if (attacker.classname == "monster_enforcer")
  1393.                     bprint (" was blasted by an Enforcer\n");
  1394.                 if (attacker.classname == "monster_fish")
  1395.                     bprint (" was fed to the Rotfish\n");
  1396.                 if (attacker.classname == "monster_hell_knight")
  1397.                     bprint (" was slain by a Death Knight\n");
  1398.                 if (attacker.classname == "monster_knight")
  1399.                     bprint (" was slashed by a Knight\n");
  1400.                 if (attacker.classname == "monster_ogre")
  1401.                     bprint (" was destroyed by an Ogre\n");
  1402.                 if (attacker.classname == "monster_oldone")
  1403.                     bprint (" became one with Shub-Niggurath\n");
  1404.                 if (attacker.classname == "monster_shalrath")
  1405.                     bprint (" was exploded by a Vore\n");
  1406.                 if (attacker.classname == "monster_shambler")
  1407.                     bprint (" was smashed by a Shambler\n");
  1408.                 if (attacker.classname == "monster_tarbaby")
  1409.                     bprint (" was slimed by a Spawn\n");
  1410.                 if (attacker.classname == "monster_vomit")
  1411.                     bprint (" was vomited on by a Vomitus\n");
  1412.                 if (attacker.classname == "monster_wizard")
  1413.                     bprint (" was scragged by a Scrag\n");
  1414.                 if (attacker.classname == "monster_zombie")
  1415.                     bprint (" joins the Zombies\n");
  1416.  
  1417.                 return;
  1418.             }
  1419.             if (attacker.classname == "explo_box")
  1420.             {
  1421.                 bprint (" blew up\n");
  1422.                 return;
  1423.             }
  1424.             if (attacker.solid == SOLID_BSP && attacker != world)
  1425.             {    
  1426.                 bprint (" was squished\n");
  1427.                 return;
  1428.             }
  1429.             if (targ.deathtype == "falling")
  1430.             {
  1431.                 targ.deathtype = "";
  1432.                 bprint (" fell to his death\n");
  1433.                 return;
  1434.             }
  1435.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1436.             {
  1437.                 bprint (" was spiked\n");
  1438.                 return;
  1439.             }
  1440.             if (attacker.classname == "fireball")
  1441.             {
  1442.                 bprint (" ate a lavaball\n");
  1443.                 return;
  1444.             }
  1445.             if (attacker.classname == "trigger_changelevel")
  1446.             {
  1447.                 bprint (" tried to leave\n");
  1448.                 return;
  1449.             }
  1450.  
  1451.             bprint (" died\n");
  1452.         }
  1453.     }
  1454. };
  1455.  
  1456. void () ChasecamNewlevel =
  1457. {
  1458.   if (self.owner.speed & CHASECAM_ON)
  1459.     ChasecamStart (self.owner);
  1460.  
  1461.   if (self.owner.speed & LASER_ON)
  1462.   {
  1463.     self.owner.speed = self.owner.speed - LASER_ON;
  1464.     LaserToggle (self.owner);
  1465.   }
  1466.  
  1467.   remove (self);
  1468. };
  1469.